;;   This file is part of scheme-GNUnet, a partial Scheme port of GNUnet
;;   scheme-GNUnet contains scheme-extractor.
;;   scheme-extractor is a partial Scheme port of libextractor.
;;   A previous iteration of this file is part of libextractor.
;;   Copyright (C) 2002-2017 Vidyut Samanta and Christian Grothoff
;;   Copyright (C) 2020 Maxime Devos
;;
;;   libextractor is free software; you can redistribute it and/or modify
;;   it under the terms of the GNU General Public License as published
;;   by the Free Software Foundation; either version 3, or (at your
;;   option) any later version.
;;
;;   libextractor is distributed in the hope that it will be useful, but
;;   WITHOUT ANY WARRANTY; without even the implied warranty of
;;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;   General Public License for more details.
;;
;;   You should have received a copy of the GNU General Public License
;;   along with libextractor; see the file COPYING.  If not, write to the
;;   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;;   Boston, MA 02110-1301, USA.

;; SPDX-License-Identifier: GPL-3.0-or-later
;; Upstream source: src/include/extractor.h
;; TODO: this compiles slowly (3 s). Perhaps resolve
;; all references at compile-time?

(library (gnu extractor metatypes)
  (export meta-type?
	  meta-type->integer
	  integer->meta-type
	  RESERVED
	  MIMETYPE
	  FILENAME
	  COMMENT
	  TITLE
	  BOOK_TITLE
	  BOOK_EDITION
	  BOOK_CHAPTER_NUMBER
	  JOURNAL_NAME
	  JOURNAL_VOLUME
	  JOURNAL_NUMBER
	  PAGE_COUNT
	  PAGE_RANGE
	  AUTHOR_NAME
	  AUTHOR_EMAIL
	  AUTHOR_INSTITUTION
	  PUBLISHER
	  PUBLISHER_ADDRESS
	  PUBLISHER_INSTITUTION
	  PUBLISHER_SERIES
	  PUBLICATION_TYPE
	  PUBLICATION_YEAR
	  PUBLICATION_MONTH
	  PUBLICATION_DAY
	  PUBLICATION_DATE
	  BIBTEX_EPRINT
	  BIBTEX_ENTRY_TYPE
	  LANGUAGE
	  CREATION_TIME
	  URL
	  URI
	  ISRC
	  HASH_MD4
	  HASH_MD5
	  HASH_SHA0
	  HASH_SHA1
	  HASH_RMD160
	  GPS_LATITUDE_REF
	  GPS_LATITUDE
	  GPS_LONGITUDE_REF
	  GPS_LONGITUDE
	  LOCATION_CITY
	  LOCATION_SUBLOCATION
	  LOCATION_COUNTRY
	  LOCATION_COUNTRY_CODE
	  UNKNOWN
	  DESCRIPTION
	  COPYRIGHT
	  RIGHTS
	  KEYWORDS
	  ABSTRACT
	  SUMMARY
	  SUBJECT
	  CREATOR
	  FORMAT
	  FORMAT_VERSION
	  CREATED_BY_SOFTWARE
	  UNKNOWN_DATE
	  CREATION_DATE
	  MODIFICATION_DATE
	  LAST_PRINTED
	  LAST_SAVED_BY
	  TOTAL_EDITING_TIME
	  EDITING_CYCLES
	  MODIFIED_BY_SOFTWARE
	  REVISION_HISTORY
	  EMBEDDED_FILE_SIZE
	  FINDER_FILE_TYPE
	  FINDER_FILE_CREATOR
	  PACKAGE_NAME
	  PACKAGE_VERSION
	  SECTION
	  UPLOAD_PRIORITY
	  PACKAGE_DEPENDENCY
	  PACKAGE_CONFLICTS
	  PACKAGE_REPLACES
	  PACKAGE_PROVIDES
	  PACKAGE_RECOMMENDS
	  PACKAGE_SUGGESTS
	  PACKAGE_MAINTAINER
	  PACKAGE_INSTALLED_SIZE
	  PACKAGE_SOURCE
	  PACKAGE_ESSENTIAL
	  TARGET_ARCHITECTURE
	  PACKAGE_PRE_DEPENDENCY
	  LICENSE
	  PACKAGE_DISTRIBUTION
	  BUILDHOST
	  VENDOR
	  TARGET_OS
	  SOFTWARE_VERSION
	  TARGET_PLATFORM
	  RESOURCE_TYPE
	  LIBRARY_SEARCH_PATH
	  LIBRARY_DEPENDENCY
	  CAMERA_MAKE
	  CAMERA_MODEL
	  EXPOSURE
	  APERTURE
	  EXPOSURE_BIAS
	  FLASH
	  FLASH_BIAS
	  FOCAL_LENGTH
	  FOCAL_LENGTH_35MM
	  ISO_SPEED
	  EXPOSURE_MODE
	  METERING_MODE
	  MACRO_MODE
	  IMAGE_QUALITY
	  WHITE_BALANCE
	  ORIENTATION
	  MAGNIFICATION
	  IMAGE_DIMENSIONS
	  PRODUCED_BY_SOFTWARE
	  THUMBNAIL
	  IMAGE_RESOLUTION
	  SOURCE
	  CHARACTER_SET
	  LINE_COUNT
	  PARAGRAPH_COUNT
	  WORD_COUNT
	  CHARACTER_COUNT
	  PAGE_ORIENTATION
	  PAPER_SIZE
	  TEMPLATE
	  COMPANY
	  MANAGER
	  REVISION_NUMBER
	  DURATION
	  ALBUM
	  ARTIST
	  GENRE
	  TRACK_NUMBER
	  DISC_NUMBER
	  PERFORMER
	  CONTACT_INFORMATION
	  SONG_VERSION
	  PICTURE
	  COVER_PICTURE
	  CONTRIBUTOR_PICTURE
	  EVENT_PICTURE
	  LOGO
	  BROADCAST_TELEVISION_SYSTEM
	  SOURCE_DEVICE
	  DISCLAIMER
	  WARNING
	  PAGE_ORDER
	  WRITER
	  PRODUCT_VERSION
	  CONTRIBUTOR_NAME
	  MOVIE_DIRECTOR
	  NETWORK_NAME
	  SHOW_NAME
	  CHAPTER_NAME
	  SONG_COUNT
	  STARTING_SONG
	  PLAY_COUNTER
	  CONDUCTOR
	  INTERPRETATION
	  COMPOSER
	  BEATS_PER_MINUTE
	  ENCODED_BY
	  ORIGINAL_TITLE
	  ORIGINAL_ARTIST
	  ORIGINAL_WRITER
	  ORIGINAL_RELEASE_YEAR
	  ORIGINAL_PERFORMER
	  LYRICS
	  POPULARITY_METER
	  LICENSEE
	  MUSICIAN_CREDITS_LIST
	  MOOD
	  SUBTITLE
	  GNUNET_DISPLAY_TYPE
	  GNUNET_FULL_DATA
	  RATING
	  ORGANIZATION
	  RIPPER
	  PRODUCER
	  GROUP
	  GNUNET_ORIGINAL_FILENAME
	  DISC_COUNT
	  CODEC
	  VIDEO_CODEC
	  AUDIO_CODEC
	  SUBTITLE_CODEC
	  CONTAINER_FORMAT
	  BITRATE
	  NOMINAL_BITRATE
	  MINIMUM_BITRATE
	  MAXIMUM_BITRATE
	  SERIAL
	  ENCODER
	  ENCODER_VERSION
	  TRACK_GAIN
	  TRACK_PEAK
	  ALBUM_GAIN
	  ALBUM_PEAK
	  REFERENCE_LEVEL
	  LOCATION_NAME
	  LOCATION_ELEVATION
	  LOCATION_HORIZONTAL_ERROR
	  LOCATION_MOVEMENT_SPEED
	  LOCATION_MOVEMENT_DIRECTION
	  LOCATION_CAPTURE_DIRECTION
	  SHOW_EPISODE_NUMBER
	  SHOW_SEASON_NUMBER
	  GROUPING
	  DEVICE_MANUFACTURER
	  DEVICE_MODEL
	  AUDIO_LANGUAGE
	  CHANNELS
	  SAMPLE_RATE
	  AUDIO_DEPTH
	  AUDIO_BITRATE
	  MAXIMUM_AUDIO_BITRATE
	  VIDEO_DIMENSIONS
	  VIDEO_DEPTH
	  FRAME_RATE
	  PIXEL_ASPECT_RATIO
	  VIDEO_BITRATE
	  MAXIMUM_VIDEO_BITRATE
	  SUBTITLE_LANGUAGE
	  VIDEO_LANGUAGE
	  TOC
	  VIDEO_DURATION
	  AUDIO_DURATION
	  SUBTITLE_DURATION
	  AUDIO_PREVIEW
	  NARINFO
	  NAR)
  (import (gnu extractor enum))

  (define-wrapped-enum (<meta-type> meta-type? integer->meta-type
				    meta-type->integer)
    (#:max 4294967295)
    (#:known
     (RESERVED 0)
     (MIMETYPE 1)
     (FILENAME 2)
     (COMMENT 3)
     ;; Standard types from bibtex
     (TITLE 4)
     (BOOK_TITLE 5)
     (BOOK_EDITION 6)
     (BOOK_CHAPTER_NUMBER 7)
     (JOURNAL_NAME 8)
     (JOURNAL_VOLUME 9)
     (JOURNAL_NUMBER 10)
     (PAGE_COUNT 11)
     (PAGE_RANGE 12)
     (AUTHOR_NAME 13)
     (AUTHOR_EMAIL 14)
     (AUTHOR_INSTITUTION 15)
     (PUBLISHER 16)
     (PUBLISHER_ADDRESS 17)
     (PUBLISHER_INSTITUTION 18)
     (PUBLISHER_SERIES 19)
     (PUBLICATION_TYPE 20)
     (PUBLICATION_YEAR 21)
     (PUBLICATION_MONTH 22)
     (PUBLICATION_DAY 23)
     (PUBLICATION_DATE 24)
     (BIBTEX_EPRINT 25)
     (BIBTEX_ENTRY_TYPE 26)
     (LANGUAGE 27)
     (CREATION_TIME 28)
     (URL 29)
     ;; "unique" document identifiers
     (URI 30)
     (ISRC 31)
     (HASH_MD4 32)
     (HASH_MD5 33)
     (HASH_SHA0 34)
     (HASH_SHA1 35)
     (HASH_RMD160 36)

     ;; identifiers of a location
     (GPS_LATITUDE_REF 37)
     (GPS_LATITUDE 38)
     (GPS_LONGITUDE_REF 39)
     (GPS_LONGITUDE 40)
     (LOCATION_CITY 41)
     (LOCATION_SUBLOCATION 42)
     (LOCATION_COUNTRY 43)
     (LOCATION_COUNTRY_CODE 44)

     ;;  generic attributes
     (UNKNOWN 45)
     (DESCRIPTION 46)
     (COPYRIGHT 47)
     (RIGHTS 48)
     (KEYWORDS 49)
     (ABSTRACT 50)
     (SUMMARY 51)
     (SUBJECT 52)
     (CREATOR 53)
     (FORMAT 54)
     (FORMAT_VERSION 55)

     ;; processing history
     (CREATED_BY_SOFTWARE 56)
     (UNKNOWN_DATE 57)
     (CREATION_DATE 58)
     (MODIFICATION_DATE 59)
     (LAST_PRINTED 60)
     (LAST_SAVED_BY 61)
     (TOTAL_EDITING_TIME 62)
     (EDITING_CYCLES 63)
     (MODIFIED_BY_SOFTWARE 64)
     (REVISION_HISTORY 65)

     (EMBEDDED_FILE_SIZE 66)
     (FINDER_FILE_TYPE 67)
     (FINDER_FILE_CREATOR 68)

     ;; software package specifics (deb, rpm, tgz, elf)
     (PACKAGE_NAME 69)
     (PACKAGE_VERSION 70)
     (SECTION 71)
     (UPLOAD_PRIORITY 72)
     (PACKAGE_DEPENDENCY 73)
     (PACKAGE_CONFLICTS 74)
     (PACKAGE_REPLACES 75)
     (PACKAGE_PROVIDES 76)
     (PACKAGE_RECOMMENDS 77)
     (PACKAGE_SUGGESTS 78)
     (PACKAGE_MAINTAINER 79)
     (PACKAGE_INSTALLED_SIZE 80)
     (PACKAGE_SOURCE 81)
     (PACKAGE_ESSENTIAL 82)
     (TARGET_ARCHITECTURE 83)
     (PACKAGE_PRE_DEPENDENCY 84)
     (LICENSE 85)
     (PACKAGE_DISTRIBUTION 86)
     (BUILDHOST 87)
     (VENDOR 88)
     (TARGET_OS 89)
     (SOFTWARE_VERSION 90)
     (TARGET_PLATFORM 91)
     (RESOURCE_TYPE 92)
     (LIBRARY_SEARCH_PATH 93)
     (LIBRARY_DEPENDENCY 94)

     ;; photography specifics
     (CAMERA_MAKE 95)
     (CAMERA_MODEL 96)
     (EXPOSURE 97)
     (APERTURE 98)
     (EXPOSURE_BIAS 99)
     (FLASH 100)
     (FLASH_BIAS 101)
     (FOCAL_LENGTH 102)
     (FOCAL_LENGTH_35MM 103)
     (ISO_SPEED 104)
     (EXPOSURE_MODE 105)
     (METERING_MODE 106)
     (MACRO_MODE 107)
     (IMAGE_QUALITY 108)
     (WHITE_BALANCE 109)
     (ORIENTATION 110)
     (MAGNIFICATION 111)

     ;; image specifics
     (IMAGE_DIMENSIONS 112)
     (PRODUCED_BY_SOFTWARE 113)
     (THUMBNAIL 114)
     (IMAGE_RESOLUTION 115)
     (SOURCE 116)

     ;; (text) document processing specifics
     (CHARACTER_SET 117)
     (LINE_COUNT 118)
     (PARAGRAPH_COUNT 119)
     (WORD_COUNT 120)
     (CHARACTER_COUNT 121)
     (PAGE_ORIENTATION 122)
     (PAPER_SIZE 123)
     (TEMPLATE 124)
     (COMPANY 125)
     (MANAGER 126)
     (REVISION_NUMBER 127)

     ;; music / video specifics
     (DURATION 128)
     (ALBUM 129)
     (ARTIST 130)
     (GENRE 131)
     (TRACK_NUMBER 132)
     (DISC_NUMBER 133)
     (PERFORMER 134)
     (CONTACT_INFORMATION 135)
     (SONG_VERSION 136)
     (PICTURE 137)
     (COVER_PICTURE 138)
     (CONTRIBUTOR_PICTURE 139)
     (EVENT_PICTURE 140)
     (LOGO 141)
     (BROADCAST_TELEVISION_SYSTEM 142)
     (SOURCE_DEVICE 143)
     (DISCLAIMER 144)
     (WARNING 145)
     (PAGE_ORDER 146)
     (WRITER 147)
     (PRODUCT_VERSION 148)
     (CONTRIBUTOR_NAME 149)
     (MOVIE_DIRECTOR 150)
     (NETWORK_NAME 151)
     (SHOW_NAME 152)
     (CHAPTER_NAME 153)
     (SONG_COUNT 154)
     (STARTING_SONG 155)
     (PLAY_COUNTER 156)
     (CONDUCTOR 157)
     (INTERPRETATION 158)
     (COMPOSER 159)
     (BEATS_PER_MINUTE 160)
     (ENCODED_BY 161)
     (ORIGINAL_TITLE 162)
     (ORIGINAL_ARTIST 163)
     (ORIGINAL_WRITER 164)
     (ORIGINAL_RELEASE_YEAR 165)
     (ORIGINAL_PERFORMER 166)
     (LYRICS 167)
     (POPULARITY_METER 168)
     (LICENSEE 169)
     (MUSICIAN_CREDITS_LIST 170)
     (MOOD 171)
     (SUBTITLE 172)

     ;; GNUnet specific values (never extracted)
     (GNUNET_DISPLAY_TYPE 173)
     (GNUNET_FULL_DATA 174)
     (RATING 175)
     (ORGANIZATION 176)
     (RIPPER 177)
     (PRODUCER 178)
     (GROUP 179)
     (GNUNET_ORIGINAL_FILENAME 180)

     (DISC_COUNT 181)

     (CODEC 182)
     (VIDEO_CODEC 183)
     (AUDIO_CODEC 184)
     (SUBTITLE_CODEC 185)

     (CONTAINER_FORMAT 186)

     (BITRATE 187)
     (NOMINAL_BITRATE 188)
     (MINIMUM_BITRATE 189)
     (MAXIMUM_BITRATE 190)

     (SERIAL 191)

     (ENCODER 192)
     (ENCODER_VERSION 193)

     (TRACK_GAIN 194)
     (TRACK_PEAK 195)
     (ALBUM_GAIN 196)
     (ALBUM_PEAK 197)
     (REFERENCE_LEVEL 198)

     (LOCATION_NAME 199)
     (LOCATION_ELEVATION 200)
     (LOCATION_HORIZONTAL_ERROR 201)
     (LOCATION_MOVEMENT_SPEED 202)
     (LOCATION_MOVEMENT_DIRECTION 203)
     (LOCATION_CAPTURE_DIRECTION 204)

     (SHOW_EPISODE_NUMBER 205)
     (SHOW_SEASON_NUMBER 206)

     (GROUPING 207)

     (DEVICE_MANUFACTURER 208)
     (DEVICE_MODEL 209)

     (AUDIO_LANGUAGE 210)
     (CHANNELS 211)
     (SAMPLE_RATE 212)
     (AUDIO_DEPTH 213)
     (AUDIO_BITRATE 214)
     (MAXIMUM_AUDIO_BITRATE 215)

     (VIDEO_DIMENSIONS 216)
     (VIDEO_DEPTH 217)
     (FRAME_RATE 218)
     (PIXEL_ASPECT_RATIO 219)
     (VIDEO_BITRATE 220)
     (MAXIMUM_VIDEO_BITRATE 221)

     (SUBTITLE_LANGUAGE 222)
     (VIDEO_LANGUAGE 223)

     (TOC 224)

     (VIDEO_DURATION 225)
     (AUDIO_DURATION 226)
     (SUBTITLE_DURATION 227)

     (AUDIO_PREVIEW 228)

     (NARINFO 229)
     (NAR 230))))
